package com.myjunjie.blog.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class JumpServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	@SuppressWarnings("static-access")
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		HttpSession session = req.getSession();

		String user_id = req.getParameter("user");
		user_id = session.getAttribute("user").toString();

		if (user_id != "") {
			 resp.setStatus(resp.SC_MOVED_TEMPORARILY);
			 resp.setHeader("Location", "admit/master.html");
			// 请求转发
			//req.getRequestDispatcher("admit/master.html").forward(req, resp);
		} else {
			resp.sendRedirect("error.html");
		}
	}
}